#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QMainWindow>
#include <QtSerialPort/QSerialPortInfo>
#include <QtSerialPort/QtSerialPort>
#include <QFileDialog>
#include <QMessageBox>
#include <QCloseEvent>
#include <QGraphicsScene>
#include <QMovie>
#include <iostream>
#include <QGraphicsItem>
#include <QGraphicsView>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    void serial_write(unsigned char *buf, int len);

private:
    Ui::MainWindow *ui;

    QSerialPort serial;
    QTimer timer;
    QTimer timer2;
    QTimer timer3;
    int open_flag;
    QStringList serial_Name_list;
    int close_flag;
uint8_t cnt;
uint8_t value;
    char wanzheng[100];
    uint8_t fflag;

    QByteArray read_array;

    uint64_t count;
    uint64_t count2;
    float v;
    float c;
    float p;
//    float e1;


private slots:
    /* 定时检查COM口 */
    void timerOut_slot(void);
    /* 轮询 */
    void foreach1(void);
    void output(void);
    void on_serial_open_pushButton_clicked();
    void on_pushButton_3_clicked();
    void on_pushButton_2_clicked();

    void read_serial_slot(void);
    void on_pushButton_sand1_clicked();
    void on_pushButton_clicked();
    void on_pushButton_4_clicked();
    void on_pushButton_5_clicked();
    void on_pushButton_6_clicked();


    void on_pushButton_8_clicked();
    void on_pushButton_9_clicked();
    void delay(unsigned int msec);
};

#endif // MAINWINDOW_H
